import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

export default new Vuex.Store({
  state: {
    actived: "",
    userData: {
      realName: null,//真实姓名,如"管理员"
      roleName: null,//角色,admin管理员、educator教员、student学员
      sex: null,//用户性别
      userId: null,//用户Id
      username: null,//账号
    },

  },
  getters: {
    actived(state) {
      return state.actived;
    },
    userData(state) {
      return state.userData;
    }
  },
  mutations: {
    setActived(state, data) {
      state.actived = data;
    },
    setUserData(state, data) {
      state.userData.realName = data.realName;//真实姓名,如"管理员"
      state.userData.roleName = data.roleName;//角色,admin管理员、educator教员、student学员
      state.userData.sex = data.sex;//用户性别
      state.userData.userId = data.userId;//用户Id
      state.userData.username = data.username;//账号
    },
  },
  actions: {
  }
})
